#region License Revision: 0 Last Revised: 6/18/2008 11:00 AM
/******************************************************************************
Copyright (c) Microsoft Corporation.  All rights reserved.


This file is licensed under the Microsoft Public License (Ms-PL). A copy of the Ms-PL should accompany this file. 
If it does not, you can obtain a copy from: 

http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
******************************************************************************/
#endregion // License
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VIEWS
{
    /// <summary>
    /// Provides data for the <see cref="VEMap.Find">Find</see> method of the <see cref="VEMap"/> class.
    /// </summary>
    public class FindOptions
    {
        private bool callback = true;
        private bool createResults = true;
        private int numberOfResults = 10;
        private bool setBestMapView = true;
        private VEShapeLayer shapeLayer;
        private bool showResults = true;
        private int startIndex;
        private bool useDefaultDisambiguation = true;

        /// <summary>
        /// Initializes a new <see cref="FindOptions"/> instance.
        /// </summary>
        public FindOptions()
        {
        }

        /// <summary>
        /// Gets or sets a value that indicates if the <see cref="VEMap.FindCompleted">FindCompleted</see> event will be raised.
        /// </summary>
        /// <value>
        /// <c>true</c> if the <see cref="VEMap.FindCompleted">FindCompleted</see> event will be raised; otherwise <c>false</c>. 
        /// The default is <c>true</c>.
        /// </value>
        /// <remarks>
        /// If <see cref="UseDefaultDisambiguation"/> is <c>true</c> the event will fire until after the user has made a 
        /// disambiguation choice.
        /// </remarks>
        public bool Callback
        {
            get { return callback; }
            set { callback = value; }
        }

        /// <summary>
        /// Gets or sets a value that indicates whether pushpins are created when the what parameter is supplied.
        /// </summary>
        /// <value>
        ///  <c>true</c> if pushpins should be created; otherwise <c>false</c>. The default is <c>true</c>.
        /// </value>
        /// <remarks>
        /// If this member is <c>false</c> the results will still be suppplied but no pushpin layer is created. 
        /// The layer reference will be <see langword="null"/> and each results corresponding 
        /// <see cref="VEFindResult.Shape">Shape</see> property will also be <see langword="null"/>.
        /// </remarks>
        public bool CreateResults
        {
            get { return createResults; }
            set { createResults = value; }
        }

        /// <summary>
        /// Gets or sets the number of results to be returned, starting at <see cref="StartIndex"/>.
        /// </summary>
        /// <value>
        /// The number of results to be returned, starting at <see cref="StartIndex"/>. The default is 10, 
        /// the minimum is 1, and the maximum is 20.
        /// </value>
        public int NumberOfResults
        {
            get { return numberOfResults; }
            set
            {
                // Validate
                if ((value < 1) || (value > 20)) throw new ArgumentOutOfRangeException("value");
                numberOfResults = value;
            }
        }

        /// <summary>
        /// Gets or sets a value that indicates whether the map view should be moved to the first match.
        /// </summary>
        /// <remarks>
        /// <c>true</c> if the map view should be moved to the first match; otherwise <c>false</c>. 
        /// The default is <c>true</c>.
        /// </remarks>
        public bool SetBestMapView
        {
            get { return setBestMapView; }
            set { setBestMapView = value; }
        }

        /// <summary>
        /// Gets or sets the layer that will contain pins resulting from this search if it is a "what" component.
        /// </summary>
        /// <value>
        /// The layer that will contain pins resulting from this search if it is a "what" component.
        /// </value>
        /// <remarks>
        /// If the shape layer is not specified, the pins are added to the base map layer. If the reference is not a valid layer an exception is thrown.
        /// </remarks>
        public VEShapeLayer ShapeLayer
        {
            get { return shapeLayer; }
            set { shapeLayer = value; }
        }

        /// <summary>
        /// Gets or sets a value that indicates if resulting pushpins are visible.
        /// </summary>
        /// <value>
        /// <c>true</c> if resulting pushpins are visible; otherwise <c>false</c>. The default is <c>true</c>.
        /// </value>
        public bool ShowResults
        {
            get { return showResults; }
            set { showResults = value; }
        }

        /// <summary>
        /// Gets or sets the beginning index of the results returned.
        /// </summary>
        /// <value>
        /// The beginning index of the results returned. The default is 0.
        /// </value>
        public int StartIndex
        {
            get { return startIndex; }
            set { startIndex = value; }
        }

        /// <summary>
        /// Gets or sets a value that indicates whether the default disambiguation box appears when multiple 
        /// location matches are possible.
        /// </summary>
        /// <value>
        /// <c>true</c> if the disambiguation box appears when multiple location matches are possible; 
        /// otherwise <c>false</c>. The defualt is <c>true</c>.
        /// </value>
        public bool UseDefaultDisambiguation
        {
            get { return useDefaultDisambiguation; }
            set { useDefaultDisambiguation = value; }
        }
    }
}
